package com.wzgl.core.controller;

import java.util.List;

import org.apache.log4j.Logger;

import com.jfinal.aop.Before;
import com.jfinal.aop.Duang;
import com.jfinal.core.Controller;
import com.jfinal.plugin.activerecord.Record;
import com.wzgl.core.baseModel.RecordBaseDao;
import com.wzgl.core.interceptor.RequiredUserIdInterceptor;
import com.wzgl.core.server.HomeService;
import com.wzgl.core.utils.JsonUtil;

public class HomeController extends Controller {
//	private Log log=Logger.getLog(HomeController.class);
	static final Logger log =   Logger.getLogger(HomeController.class);
	HomeService hs = Duang.duang(HomeService.class);
	
	/***
	 * CacheInterceptor 将 action 所需数据全部缓存起来
	 */
	@Before(RequiredUserIdInterceptor.class)
	public void index() {
		//List<Tdicinfo> dic = Tdicinfo.dao.getTdicBySort(PropKit.use("wzgl_tdinc_conts.txt").get("tdic_wzlx"));
		List<Record> dic;
		try {
			dic = RecordBaseDao.find(null, "Tdicinfo");
		    setAttr("dic", JsonUtil.RecordTojson(dic));
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		log.warn("首页我来了！");
		render("index.jsp");;
	}
	
	public void insertTx(){
		render("index.jsp");
	}
	public void loginOut(){
		render("login.jsp");
	}
}
